﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Boco.Digg.Service
{
	public class Method : IMethod
	{
		private string _endPoint;
		private Dictionary<string, string> _arguments;

		public Method()
		{
			_arguments = new Dictionary<string, string>();
		}

		public string Endpoint
		{
			get { return _endPoint; }
			set { _endPoint = value; }
		}

		public Dictionary<string, string> Arguments
		{
			get { return _arguments; }
		}

		public override string ToString()
		{
			StringBuilder builder = new StringBuilder();
			builder.Append(_endPoint);
			builder.Append("?");
			foreach (KeyValuePair<string, string> pair in _arguments)
			{
				builder.Append(pair.Key);
				builder.Append("=");
				builder.Append(pair.Value);
				builder.Append("&");
			}
			builder.Remove(builder.Length - 1, 1);
			return builder.ToString();
		}
	}
}
